<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue-router/3.4.8/vue-router.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .herder {
            height: 100px;
            background-color: hotpink;
        }

        .left {
            float: left;
            width: 30%;
            height: 500px;
            background-color: aqua;
        }

        .right {
            float: left;
            width: 70%;
            height: 500px;
            background-color: lawngreen;

        }

        li {
            font-size: 30px;
            color: red;
        }
        .yellow {
            float: left;
            width: 70%;
            height: 500px;
            background-color: yellow;
        }
        .red{
            float: left;
            width: 70%;
            height: 500px;
            background-color: red;
        }
        .black{
            float: left;
            width: 70%;
            height: 500px;
            background-color: black;
        }
    </style>
</head>

<body>
    <div id='app'>

        <div class="herder">

        </div>
        <div class="left">
            <ul>
                <li>
                    <router-link to="/yellow">黄色</router-link>
                </li>
                <li>
                    <router-link to="/green">绿色</router-link>
                </li>
                <li>
                    <router-link to="/red">红色</router-link>
                </li>
                <li>
                    <router-link to="/black">黑色</router-link>
                </li>
            </ul>
        </div>


        <router-view></router-view>
    </div>
    <!-- 右边 -->
    <template id="myright">
        <div class="right">

        </div>
    </template>
    <script>
        let myright={
            template:"#myright"
        }
    </script>


<!-- 黄色 -->
<template id="yellow">
    <div class="yellow">

    </div>
</template>
<script>
    let yellow={
        template:"#yellow"
    }
</script>

<!-- 绿色 -->
<template id="green">
    <div class="right">

    </div>
</template>
<script>
    let green={
        template:"#green"
    }
</script>

<!-- 红色 -->
<template id="red">
    <div class="red">

    </div>
</template>
<script>
    let red={
        template:"#red"
    }
</script>

<!-- 黑色 -->
<template id="black">
    <div class="black">

    </div>
</template>
<script>
    let black={
        template:"#black"
    }
</script>



    <script>
        let router = new VueRouter({
            routes: [
                {
                    path: "/",
                    redirect: "/index"
                },
                {
                    path: "/index",
                    component: myright
                },
                {
                    path:"/yellow",
                    component: yellow,
                },
                {
                    path:"/green",
                    component: green,
                },
                {
                    path:"/red",
                    component: red,
                },
                {
                    path:"/black",
                    component: black,
                }
            ]
        })

        const vm = new Vue({
            el: '#app',
            data: {
            },
            router
        })
    </script>
</body>

</html>